#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
import os
from ament_index_python.packages import get_package_share_directory

def generate_launch_description():
    # 获取包路径
    pkg_dir = get_package_share_directory('fruit_cam')
    
    # 左相机启动文件
    left_camera_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            os.path.join(pkg_dir, 'launch', 'left_camera.launch.py')
        ),
        launch_arguments={
            'camera_device': '/dev/video0',
            'camera_name': 'left_camera',
            'camera_frame_id': 'left_camera_optical_frame'
        }.items()
    )
    
    # 右相机启动文件
    right_camera_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            os.path.join(pkg_dir, 'launch', 'right_camera.launch.py')
        ),
        launch_arguments={
            'camera_device': '/dev/video2',
            'camera_name': 'right_camera',
            'camera_frame_id': 'right_camera_optical_frame'
        }.items()
    )
    
    return LaunchDescription([
        left_camera_launch,
        right_camera_launch
    ])
